import {transformArrayBufferToBase64} from "@/assets/js/common";

export default {
  methods: {
    // pdf预览
    handlePDF(res) {
      const url = 'data:application/pdf;base64,' + transformArrayBufferToBase64(res)
      this.pdfUrl = url
      this.modelName = 'PDF'
    },
    // 图片预览
    handleImg(res) {
      this.previewImages = []
      let code = 'data:image/jpeg;base64,'+ transformArrayBufferToBase64(res)
      this.previewImages.push(code)
      this.index = this.previewImages.length - 1
      this.isShowPreview = true
    }
  }
}
